{#**
*
* 功能描述（信息模板）
*
* @author suoya <jlusuoya@gmail.com>
* @version 1
*#}
{#if isset($g_ext) && isset($g_ext['print'])#}
	{#include file="baseheader.tpl"#}
{#else#}
{#include file="header.tpl" title="title" active="order"#}
{#include file="define.tpl" scope=parent#}
<script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="{#$web_root['web']#}js/region.js"></script>
<div class="content middle">
    <div class="ui breadcrumb">
        <a class="section" href="index.php">主页</a>
        <i class="right"></i>
        <a class="section" href="index.php?action=order.showlist">订单管理</a>
        <i class="right"></i>
        <a class="active section">订单信息</a>
    </div>
    <div class="search">
        <div class="searchTitle">
            订单信息
        </div>
        <div class="searchBar" style=" line-height: normal; padding: 5px;">
        <div class="inputDIV">
		<table class="ui table segment infotable">
		<tr>
			<td>订单号码：{#$data['id']+$orderid_base#}</td>
			<td>订单类型：{#$g_ordertype[$data['type']]#} {#if $data['add_adm'] == 0#}网络订单{#else#}<a href="#" onclick="return showadm({#$data['cofm_adm']#})">电话订单</a>{#/if#}</td>
			<td>下单时间：{#$data['createtime']#}</td>
			<td>订单状态：
			{#if $data['status'] == 1 && $data['pay_adm'] != 0#}
				{#if $data['pay_adm'] != 0#}
				<a title='完成订单，产生积分和销量' href='index.php?action=order.setstatus&id={#$data['id']#}&status=2' onclick='order_setsta(this, "确认", 1); return false'>完成</a>
				{#/if#}
				<a title='取消订单，付款之后可完成' href='index.php?action=order.setstatus&id={#$data['id']#}&status=3' onclick='order_setsta(this, "取消", 1); return false'>取消</a>
			{#else#}
				{#$o_sta[$data['status']]#}
			{#/if#}
			</td>
			<td>确认状态：{#if $data['cofm_adm'] == 0#}未确认
				{#else#}<a href="#" onclick="return showadm({#$data['cofm_adm']#})">ID：{#$data['cofm_adm']#}确认</a>{#/if#}</td>
		</tr>
		</table>
		</div>
		</div>
	</div>
    <div class="search">
        <div class="searchTitle">结算信息 <a href='javacript:vodi(0)' title='点击修改' onclick="openWindow('mod_pay', '', 300, 220, '修改订单结算信息')"/>修改金额</a></div>
		<div style='display:none' id='mod_pay'>
		<div class='win_body'>
		{#if $data['status'] != 1#}
			仅进行中的订单可以修改金额
		{#else#}
		<form action='index.php?action=order.modamount&id={#$data['id']#}' method='POST' onsubmit='if(ajax_commit(this)==0) $.jBox.close(); return false'>
			订单积分：<input name='score' value='{#$data['add_score']#}'/><br/>
			付款金额：<input name='amount' value='{#$data['amount']#}'/><br/>
			订单留言：<textarea name="message">{#$data['message']#}</textarea><br/>
				<input type='submit' value='修改' />
		</form>
		{#/if#}
		</div>
		</div>
        <div class="searchBar" style=" line-height: normal; padding: 5px;">
        <div class="inputDIV">
		<table class="ui table segment infotable">
		<tr>
			<td>订单总价：￥{#$data['amount_pre']#}元</td>
			<td>代金券码：{#$data['money1_code']#}</td>
			<td>代金券抵：￥{#$data['trade_money1']#}元</td>
			<td>积分消耗：{#$data['money2_code']#}</td>
			<td>积分兑换：{#$data['trade_money2']#}</td>
			<td>付款金额：{#$data['amount']#}</td>
			<td>订单积分：{#$data['add_score']#}</td>
		</tr>
		<tr>
			<td>支付类型：{#if $data['pay_adm'] == 0 && $data['status'] == 1#}
				<select name="pay_type" onchange="ajax_value(this, 'index.php?action=order.modpaytype&id={#$data['id']#}&pay_type=')">
				{#foreach $p_type as $k => $item#}
				{#if $k != $data['pay_type']#}
					<option value="{#$k#}">{#$item#}</option>
				{#else#}
					<option value="{#$k#}" selected>{#$item#}</option>
				{#/if#}
				{#/foreach#}
				</select>
			{#else#}
				{#$p_type[$data['pay_type']]#}
			{#/if#}</td>
			<td>收款状态：
				<span id='pay_{#$data['id']#}'>
                        {#if $data['pay_adm'] == 0#}
								{#if $data['status'] == 1#}
                            <a title='点击付款' href="javascript:void(0)" onclick="openWindow(null, 'index.php?action=order.payui&id={#$data['id']#}', 400, 300, '订单付款')">未付款</a>
								{#else#}
									未付款
								{#/if#}
                        {#else#}
                            <a title='点击查看收款管理员信息' href="#" onclick="return showadm({#$data['pay_adm']#})">ID {#$data['pay_adm']#}</a>
							{#if $data['status'] == 1#}
                            (<a href="index.php?action=order.setSpStatus&type=2&id={#$data['id']#}&status=0" onclick="ajax_this(this, '取消之后原付款记录有效,仅适用于追加款项, 确认订单金额已是追加金额?');return false">取消</a>)
							{#/if#}
						{#/if#}
					</span>
			</td>
			<td colspan='4'>交易备注：</td>
		</tr>
		</table>
		</div>
		</div>
	</div>
    <div class="search">
        <div class="searchTitle">配送信息 <a href='javacript:vodi(0)' title='点击修改' onclick="openWindow('mod_dely', '', 500, 320, '修改订单结算信息', setslot)"/>修改配送</a></div>
		<div style='display:none' id='mod_dely'>
		<div class='win_body'>
		{#if $data['status'] != 1#}
			仅进行中的订单可以修改配送方式
			<script>
			function setslot(obj) {}
			</script>
		{#else#}
		<form action='index.php?action=order.moddely&id={#$data['id']#}' method='POST' onsubmit='if(ajax_commit(this) == 0) $.jBox.close(); return false'>
			收 货 人：<input name='consignee' value='{#$data['consignee']#}'/><br/>
			收货电话：<input name='mobile_to' value='{#$data['mobile_to']#}'/><br/>
			送货日期：<input name='dely_date' value='{#$dely_date#}' type='text' onClick="WdatePicker({minDate: '{#$cur_date#}'})" readonly class="input_text"/>
                       <select name='dely_time'>{#include file="timeslot.tpl"#}</select><br/>
			送货方式：<select name='dely_type'>{#foreach $g_dely_type as $k => $v#}
						<option value='{#$k#}' {#if $k == $data['delivery_type']#}selected{#/if#}>{#$v#}</option>{#/foreach#}
					  </select><br/>
			标记建筑：<input name='sign_build' value='{#$data['sign_building']#}'/><br/>
			送货区域：<input readonly name='true_area' value='{#$data['area']#}'/>
                            <input type="hidden" name="province" value="19" />
							<select name="city" onchange="region.changed(this, 2, 'selDistricts_')">
                                <option value="0">请选择市</option>
                            </select>
                            <select name="district" onchange="region.changed(this, 3, 'selArea_');
                                    ch_area()">
                                <option value="0">请选择区</option>
                            </select>
                            <select name="area" style="display:none;" onchange="ch_area()">
                                <option value="0">请选择区域</option>
                            </select><br/>
			送货地址：<input name='address' value='{#$data['address']#}'/><br/>
			订单留言：<textarea name="message">{#$data['message']#}</textarea><br/>
				<input type='submit' value='修改' />
		</form>
		<script>
			function ch_area() {
				var dist = $("#selDistricts_").val();
				if (dist == 0)
					return;
				var obj = $("#selArea_");
				var area = "";
				if (obj.css("display") != "none") {
					area = obj.val();
					if (area == 0)
						return;
				}
				var true_area = region.GetAddress($("#selProvinces_").val(), $("#selCities_").val(), dist, area);
				$("#true_area").val(true_area);
			}
			function setslot(obj)
			{
				$("[name='true_area']", $(obj)).attr('id', 'true_area');
				$("[name='province']", $(obj)).attr('id', 'selProvinces_');
				$("[name='city']", $(obj)).attr('id', 'selCities_');
				$("[name='district']", $(obj)).attr('id', 'selDistricts_');
				$("[name='area']", $(obj)).attr('id', "selArea_");
        		region.loadCities(19, 'selCities_');
				$("[name='dely_time']", $(obj)).val('{#$dely_time#}');
			}
		</script>
		{#/if#}
		</div>
		</div>
        <div class="searchBar" style=" line-height: normal; padding: 5px;">
        <div class="inputDIV">
		<table class="ui table segment infotable">
		<tr>
			<td>订货会员：<a href="#" onclick="return showuser({#$data['userid']#})">ID：{#$data['userid']#}</a></td>
			<td>订货电话：{#$data['mobile_from']#}</td>
			<td>收货人：{#$data['consignee']#}</td>
			<td>收货电话：{#$data['mobile_to']#}</td>
			<td>送货日期：{#$data['delivery_time']#}</td>
		</tr>
		<tr>
			<td>送货方式：{#$g_dely_type[$data['delivery_type']]#}</td>
			<td>邮政编码：{#if $data['zipcode'] != 0#}{#$data['zipcode']#}{#/if#}</td>
			<td>标记建筑：{#$data['sign_building']#}</td>
			<td colspan=2>送货地址：{#$data['area']#}{#$data['address']#}</td>
		</tr>
		{#if $data['delystatus'] != null#}
		<tr>
			<td>配送状态：{#$g_dely_status[$data['delystatus']]#}</td>
			<td>配送员：{#if $data['dely_adm'] != 0#}<a href="#" onclick="return showadm({#$data['dely_adm']#})">ID：{#$data['dely_adm']#}</a>{#/if#}</td>
			<td>开始时间：{#if $data['starttime'] != '0000-00-00 00:00:00'#}{#$data['starttime']#}{#/if#}</td>
			<td>结束时间：{#if $data['finishtime'] != '0000-00-00 00:00:00'#}{#$data['finishtime']#}{#/if#}</td>
			<td>配送备注：{#$data['note']#}</td>
		</tr>
		{#else#}
		<tr><td colspan=5>未通知配送</td></tr>
		{#/if#}
		</table>
		</div>
		</div>
	</div>
    <div class="search">
        <div class="searchTitle">其他信息</div>
        <div class="searchBar" style=" line-height: normal; padding: 5px;">
        <div class="inputDIV">
		<table class="ui table segment infotable">
		<tr>
			<td>发票信息：{#if $data['inv_type'] == 0#}不需要{#else#}
					发票类型：{#$inv_type[$data['inv_type']]#}
					发票抬头：{#$data['inv_title']#}
                {#/if#}
			</td>
			<td>订单留言：{#$data['message']#}</td>
		</tr>
		</table>
		</div>
		</div>
	</div>
    <div class="search">
        <div class="searchTitle">
            订单商品
        </div>
        <div class="searchBar" style=" line-height: normal; padding: 5px;">
        <div class="inputDIV">
		<table class="ui table segment">
		<tr>
			<td>巧克力牌：{#if $data['card1'] == ''#}不需要{#else#}{#$data['card1']#}{#/if#}</td>
			<td>祝福贺卡：{#if $data['card2'] == ''#}不需要{#else#}{#$data['card2']#}{#/if#}</td>
			<td><input type='checkbox' disabled {#if $data['attach1'] == 1#}checked{#/if#} />产品图册</td>
			<td><input type='checkbox' disabled {#if $data['attach2'] == 1#}checked{#/if#} />生日蜡烛</td>
		</tr>
		</table>

        <table id='orderGood' class="ui table segment">
            <thead>
                <tr>
                    <th>商品名称</th>
                    <th>规格</th>
                    <th>价格（￥）</th>
                    <th>折扣</th>
                    <th>数量</th>
                    <th>评价</th>
					<th>生产状态</th>
					<th>完成时间</th>
					<th>提取时间</th>
					<th>提取备注</th>
					<th>生产备注</th>
                </tr>
            </thead>
            <tbody>
                {#foreach $goods as $item#}
                <tr>
                        <td><a titlel='点击查看商品详情' href="{#$web_root['web']#}index.php?action=food.detail&id={#$item['good_id']#}&version={#$item['version']#}" target="_blank">{#$item['name']#}</a></td>
                        <td>{#$item['size']#}</td>
                        <td>{#$item['price']#}</td>
                        <td>{#$item['discount']*10#}折</td>
                        <td>{#$item['cnt']#}</td>
                        <td>{#if $item['comment_id'] != 0#}<a href='#' title='点击查看'>评价</a>{#/if#}</td>
						{#if $item['status'] != null#}
                        <td>{#$g_prod_status[$item['status']]#}</td>
						<td>{#if $item['finishtime'] != '0000-00-00 00:00:00'#}{#$item['finishtime']#}{#/if#}</td>
						<td>{#if $item['taketime'] != '0000-00-00 00:00:00'#}{#$item['taketime']#}{#/if#}</td>
                        <td>{#$item['takeman']#}</td>
                        <td>{#$item['note']#}</td>
						{#else#}
						<td colspan=5>未通知生产</td>
						{#/if#}
                </tr>
               {#/foreach#}
            </tbody>
        </table>
		</div>
		</div>
	</div>
    <div class="search">
        <div class="searchTitle">
            打印预览(未填充数据)
        </div>
{#/if#}
	{#include file="order_print.tpl" #}
{#if isset($g_ext) && isset($g_ext['print'])#}
	{#include file="basefooter.tpl"#}
{#else#}
    <div style="float:right;" class="ui button" onclick="gotoUrl('index.php?action=dely.showlist');">返回</div>
	<div style="float:right;margin: 3px" ></div>
	<div style="float:right;" class="ui button" name="print_page">打印</div>
</div>
	{#include file="footer.tpl" #}
{#/if#}
